var mongoose = require('../../cfg/dbconfig.js')

var interestSchema = new mongoose.Schema({
    sex:String,
    name:String,
    pid:String,
    term:String,
    zy1:String,
    zy2:String,
    classno:String
},{collection:'interest'})

interestSchema.statics.Save=async function(doc){
    let obj=new this(doc);
    let res=await obj.save();
    return res;
}

interestSchema.statics.Update=async function(doc){
    let id=doc._id;
    delete doc._id;
    let result = await this.updateOne({ _id: id }, doc).exec();
    return result
}

interestSchema.statics.GetByQuery=async function(query){
    let result= await this.findOne(query).exec();
    return result
}
module.exports = mongoose.model('interest', interestSchema)